package game;

import java.util.ArrayList;
import java.util.List;

import domain.league.ILeague;


public class GameDatabase {

	// Instance:
	private static GameDatabase instance;
	private List<IGameData> games;
	
	private GameDatabase() {
		games = new ArrayList<IGameData>();
		games.add(new GameData("Conan The Barbarian", games.size()));
		games.add(new GameData("Star Wars [is for nerds]", games.size()));
	}
	
	public static GameDatabase getInstance() {
		if (instance == null) {
			instance = new GameDatabase();
		}

		return instance;
	}
	
	public int getNumGames() {
		return games.size();
	}
	
	public List<IGameData> getGameDatabase() {
		return games;
	}
	
	public List<ILeague> getGameDatabase(int gameID) {
		for (IGameData game : games) {
			if(game.getGameID() == gameID)
				return game.getLeagues();
		}
		return null;
	}	
}
